<template>
    <div class="info-collect">
        <Crumb name="Contract Evaluation"/>
        <router-view></router-view>
    </div>
</template>

<script>
    import Crumb from '@/components/common/crumb'

    export default {
        name: "info-collect",
        data() {
            return {
                loading:false,
                ruleForm: {
                    contractNo: '',
                    customerName: '',
                    date: '',
                    delivery:'',
                    destination: '',
                    price:'',
                    manager:'Andy',
                    detail:''
                },
                rules: {
                    contractNo: [
                        { required: true, message: 'Contract No is required', trigger: 'blur' },
                    ],
                    customerName: [
                        { required: true, message: 'Name is required', trigger: 'blur' }
                    ],
                    date: [
                        {  required: true, message: 'Date is required', trigger: 'change' }
                    ],
                    delivery: [
                        {  required: true, message: 'Period is required', trigger: 'blur' }
                    ],
                    destination: [
                        {  required: true, message: 'Destination is required', trigger: 'blur' }
                    ],
                    price: [
                        {  required: true, message: 'Price is required', trigger: 'blur' }
                    ],
                },
                key: '',
                total: 11,
            }
        },
        methods: {
            submitForm(){
                this.$refs.ruleForm.validate((valid) => {
                    if (valid) {
                        this.$router.push('/my-contract')
                    } else {
                        return false;
                    }
                });
            },
            clear(){
                this.ruleForm.title = '';
                this.ruleForm.customerName = '';
                this.ruleForm.times = '';
                this.ruleForm.address = '';
                this.ruleForm.detail = '';
            },
            openAdd(){
                this.clear();
                this.dialogVisible = true
            },
            openEdit(r){
                this.ruleForm.title = r.title;
                this.ruleForm.customerName = r.customerName;
                this.ruleForm.times = r.times;
                this.ruleForm.address = r.address;
                this.ruleForm.detail = r.detail;
                this.id = r.id;
                this.dialogVisible = true

            },
            changePage(page) {
                alert(page)
            },

        },
        components: {
            Crumb
        }
    }
</script>

<style scoped lang="scss">
    .info-collect {
        background: #f6;
        .content {
            text-align: left;
            .table-wrapper {
                margin-top: 20px;
            }
            .page {
                text-align: center;
                margin-top: 10px;
            }
        }
    }
</style>